package fr.epsi.ressources;

import fr.epsi.studentsmaps.R;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class RoomCustomList extends ArrayAdapter<String>
{
	private final Activity context;
	private final String[] web;
	private final Integer[] imageId;

	public RoomCustomList(Activity context,String[] web, Integer[] imageId)
	{
		super(context, R.layout.listtemplate, web);
		this.context = context;
		this.web = web;
		this.imageId = imageId;
	}
	
	@Override
	public View getView(int position, View view, ViewGroup parent) 
	{
		LayoutInflater inflater = context.getLayoutInflater();
		View rowView= inflater.inflate(R.layout.listtemplate, null, true);
		TextView txtTitle = (TextView) rowView.findViewById(R.id.RoomTxt);
		ImageView imageView = (ImageView) rowView.findViewById(R.id.RoomImg);
		txtTitle.setText(web[position]);
		imageView.setImageResource(imageId[position]);
		return rowView;
	}

}